home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / G4C / CED / CedClip.g < prev    next >
Encoding:
Gui4CLI script  |  1999-11-24  |  4.0 KB  |  166 lines

  1. G4C
  2.  
  3. ;       CedClip.g - clipboard viewer
  4. ; --------------------------------------------------------
  5.  
  6. WINBIG 115 44 395 116 'Clipboard Viewer'
  7. WinType 11110001
  8. resinfo 8 640 256
  9.  
  10. xOnLoad
  11.     setgad cedclip.g 11 hide ; hide 2nd lv
  12.  
  13. ; --------------------------------------------------------
  14. ;       Change the clipboard unit
  15. ; --------------------------------------------------------
  16.  
  17. XICON 156 1 :icons/left
  18.     attr resize 0000
  19.     --cedbar.gc/cedClip
  20.     gosub CedClip.g changeunit
  21.  
  22. XICON 225 1 :icons/right
  23.     attr resize 0000
  24.     ++cedbar.gc/cedClip
  25.     gosub CedClip.g changeunit
  26.  
  27. XTEXTIN 170 0 53 14 "" unit '0' 10
  28.     attr resize 0000
  29.     gadid 2
  30.     gosub CedClip.g changeunit
  31.  
  32. xRoutine ChangeUnit
  33.     ; make sure the cedbar.gc/cedClip is 0-255
  34.     if $cedbar.gc/cedClip > 255
  35.        cedbar.gc/cedClip = 0
  36.     elseif $cedbar.gc/cedClip < 0
  37.        cedbar.gc/cedClip = 255
  38.     endif
  39.     ; load the given clip..
  40.     lvuse CedClip.g 1
  41.     lvchange "CLIPS:$cedbar.gc/cedClip"
  42.  
  43.     ; update the text gad
  44.     update CedClip.g 2 $cedbar.gc/cedClip
  45.  
  46.     ; and update cedbar.gc also..
  47.     update cedbar.gc 1 $cedbar.gc/cedClip
  48.     cedbar.gc/cedSend = "set clipboard unit "
  49.     AppVar cedbar.gc/cedSend $cedbar.gc/cedClip
  50.     SendRexx $cedbar.gc/cedport $cedbar.gc/cedSend
  51.  
  52. ; --------------------------------------------------------
  53. ;       Load a file into the current clipboard unit
  54. ; --------------------------------------------------------
  55.  
  56. XICON 0 0 :icons/Open
  57.     attr resize 0000
  58.     ReqFile  -1 -1 300 -30 'Choose file :' LOAD filename ''
  59.     if $filename > ''
  60.        lvuse CedClip.g 1
  61.        lvchange $filename
  62.        ; now save it so as to write it to the clipboard
  63.        lvsave 'CLIPS:$cedbar.gc/cedClip'
  64.     endif
  65.  
  66. ; --------------------------------------------------------
  67. ;       Save the current clipboard unit as a file
  68. ; --------------------------------------------------------
  69.  
  70. XICON 25 0 :icons/save
  71.     attr resize 0000
  72.     ReqFile  -1 -1 300 -30 'Save as file :' SAVE savename ''
  73.     if $savename > ' '
  74.        ifexists file $savename
  75.           ezreq 'File $savename exists.\nOverwrite ?' Overwrite|CANCEL choice
  76.           if $choice = 0
  77.              stop
  78.           endif
  79.        endif
  80.        lvsave $savename
  81.     endif
  82.  
  83. ; --------------------------------------------------------
  84. ;       Clear the current clipboard unit
  85. ; --------------------------------------------------------
  86.  
  87. XICON 50 0 :icons/Clear
  88.     attr resize 0000
  89.     lvuse CedClip.g 1
  90.     lvclear
  91.     ; update the clipboard
  92.     lvsave 'CLIPS:$cedbar.gc/cedClip'
  93.  
  94. ; --------------------------------------------------------
  95. ;       Cut 
  96. ; --------------------------------------------------------
  97.  
  98. XICON 75 0 :icons/cut
  99.     attr resize 0000
  100.     guiwindow cedclip.g wait
  101.     setgad cedclip.g 1 hide ; hide for speed
  102.     lvuse cedclip.g 11
  103.     lvclear
  104.     lvuse cedclip.g 1
  105.     lvmulti first
  106.     while $$lv.line > ''
  107.        lvclip cut 1 add cedclip.g 11
  108.        lvmulti next
  109.     endwhile
  110.     setgad cedclip.g 1 show
  111.     lvmulti show
  112.     ; write it to the clipboard
  113.     lvsave 'CLIPS:$cedbar.gc/cedClip'
  114.     guiwindow cedclip.g resume
  115.  
  116. ; --------------------------------------------------------
  117. ;       Copy
  118. ; --------------------------------------------------------
  119.  
  120. ; almost same as above..
  121. XICON 100 0 :icons/copy
  122.     attr resize 0000
  123.     guiwindow cedclip.g wait
  124.     setgad cedclip.g 1 hide ; hide for speed
  125.     lvuse cedclip.g 11
  126.     lvclear
  127.     lvuse cedclip.g 1
  128.     lvmulti first
  129.     while $$lv.line > ''
  130.        lvclip copy 1 add cedclip.g 11
  131.        lvmulti next
  132.     endwhile
  133.     setgad cedclip.g 1 show
  134.     lvmulti show
  135.     lvsave 'CLIPS:$cedbar.gc/cedClip'
  136.     guiwindow cedclip.g resume
  137.  
  138. ; --------------------------------------------------------
  139. ;       Paste - Insert records after CURRENT record
  140. ; --------------------------------------------------------
  141.  
  142. XICON 125 0 :icons/paste
  143.     attr resize 0000
  144.     guiwindow cedclip.g wait
  145.     lvuse cedclip.g 11
  146.     lvgo first
  147.     lvclip copy -1 insert cedclip.g 1
  148.     lvuse cedclip.g 1
  149.     lvsave 'CLIPS:$cedbar.gc/cedClip'
  150.     guiwindow cedclip.g resume
  151.  
  152. ; --------------------------------------------------------
  153. ;       The listviews
  154. ; --------------------------------------------------------
  155.  
  156. XLISTVIEW 1 15 393 100 "" clipline CLIPS:0 10 MULTI
  157.     gadid 1
  158.     attr resize 0022
  159.  
  160. ; hiden listview - use it as my clip holder
  161. XLISTVIEW 0 21 393 141 "" lv11 '' 10 MULTI
  162.     gadid 11
  163.  
  164.  
  165.  
  166.